home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 958 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  41 lines

  1. Path: news.iag.net!news
  2. From: jatmon@iag.net (John R Buchan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: memory allocation in Visual C++
  5. Date: 10 Jan 1996 14:46:32 GMT
  6. Organization: Internet Access Group, Orlando, Florida
  7. Message-ID: <4d0jg8$7aq@news.iag.net>
  8. References: <4cvds8$4pt@news.ust.hk>
  9. NNTP-Posting-Host: pm1-orl23.iag.net
  10. X-Newsreader: WinVN 0.99.7
  11.  
  12. In article <4cvds8$4pt@news.ust.hk>, ee_ckmaa@uxmail.ust.hk says...
  13. >
  14. >I'm writting a program which deals with a large amount of data. It's a 
  15. >16 bit program. Why I cannot allocate automatic arrays in a
  16. >function as local variables which in total occupies more than 64k? I've set 
  17. the
  18. >memory model to "large" , though.
  19. >
  20. >i.e.
  21. >
  22. >main() {
  23. >
  24. >        float a[88][88]; <----- each of them below 64k; but total of 3 is
  25. >        float b[88][88]; <----- larger than 64k .
  26. <snip>
  27.  
  28. Most likely because automatics are commonly put on the stack or in a similar
  29. predefined area.  Look into making them static (use the static specifier
  30. or make them global) or dynamic (malloc them on need <a little tricky,
  31. but the c.l.c faq list explains how>). You should look into the problems
  32. of far pointers when crossing a segment boundary.  You may need to use huge.
  33.  
  34. You should probably read through the c.l.c faq list.  It is available for 
  35. anonymous ftp from rtfm.mit.edu /pub/usenet/comp.lang.c.
  36.  
  37. -- 
  38. John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
  39. jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
  40.  
  41.